<?php

class Application_Model_BuildingsTbl extends Zend_Db_Table_Abstract{
	protected $_name = 'buildings';
	
	
  	function getBuildingIdByBuildingIdentifier($building_identifier)
    {
   		 $select = $this->_db->select()
            ->from($this->_name,array('id','building_identifier','name'))
           	->where('building_identifier=?',$building_identifier);

        $result = $this->getAdapter()->fetchRow($select);
    	return $result;
    }
    
	function getBuildingIdByBuildingName($building_name)
    {
   		 $select = $this->_db->select()
            ->from($this->_name,array('id','building_identifier','name'))
           	->where('name=?',$building_name);

        $result = $this->getAdapter()->fetchRow($select);
    	return $result;
    }
    
    function getBuildingDetailsByBuildingName($building_name)
    {
    	 $select = $this->_db->select()
            ->from($this->_name,array('id','name','building_story','type', 'building_identifier', 'initial_cost', 'cost_per_upgrade', 'max_building_lvl', 'building_restriction'))
           	->where('name=?',$building_name);

        $result = $this->getAdapter()->fetchRow($select);
    	return $result;
    }
}